/* Waifuverse Tactics: screen styles, part F — artwork cards: the card face
   (.card-face, every card the game draws), the collection (.scr-artworks), a
   card's page (.scr-artwork), the shared card tile (.art-card), and the
   artwork bits the hub, party and hero screens gained. Mobile-first (375px
   safe, no sideways page scroll). Colors come from the game.css tokens, with
   local fallbacks.

   A card is drawn ONLY by client/card-face.mjs, exactly as
   CONTRACT-ARTWORKS.md "Card frames" says: a box at the card's own shape
   (--card-aspect) that clips, the picture covering it, the rank's border on
   top. Screens never round, shadow, glow or frame a card: their badges sit
   next to it, and a highlight (focus, selection) is an outline around the
   whole tile, clear of the card. */

/* Tokens. The picker is listed too: ui.modal() mounts it outside the screen. */
.scr-artworks,
.scr-artwork,
.scr-artwork__picker {
  --sf-text: var(--text, #e9edf8);
  --sf-muted: var(--muted, #91a4bd);
  --sf-faint: var(--faint, #62738d);
  --sf-deep: var(--bg-deep, #070a12);
  --sf-surface: var(--panel, #141e2e);
  --sf-surface-2: var(--panel-2, #1a2639);
  --sf-border: var(--border, #29364c);
  --sf-border-strong: var(--border-strong, #3a4b68);
  --sf-accent: var(--accent, #7bd6c1);
  --sf-accent-2: var(--accent-2, #89dfce);
  --sf-violet: var(--violet-2, #ab92ee);
  --sf-gold: var(--gold, #e6bd7f);
  --sf-gold-2: var(--gold-2, #f3d6a4);
  --sf-good: var(--good, #86dea3);
  --sf-warn: var(--warn, #f2c46d);
  --sf-radius: var(--radius, 14px);
  --sf-radius-sm: var(--radius-sm, 10px);
  --sf-font-num: var(--font-num, ui-rounded, system-ui, sans-serif);
}

.scr-artworks,
.scr-artwork {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--maxw, 1100px);
  margin: 0 auto;
  padding: 0 var(--gutter, 16px) calc(28px + env(safe-area-inset-bottom, 0px));
  color: var(--sf-text);
}

:where(.scr-artworks, .scr-artwork, .scr-artwork__picker) * {
  box-sizing: border-box;
}

/* Zero-specificity reset so component classes always win. */
:where(.scr-artworks, .scr-artwork, .scr-artwork__picker) button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================ card face */

/* One card (client/card-face.mjs). Size it by ONE dimension: aspect-ratio
   gives the other, so the border always lines up with the picture. */
.card-face {
  position: relative;
  display: block;
  flex: none;
  box-sizing: border-box;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: var(--card-aspect, 2 / 3);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* Every layer covers the box exactly; the border's transform (scale about its
   origin, set inline from card-frames.json) may run past it and is clipped. */
.card-face__art,
.card-face__video,
.card-face__border {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.card-face__art,
.card-face__video {
  object-fit: cover;
  object-position: 50% 50%;
}

.card-face__art {
  z-index: 0;
}

.card-face__video {
  z-index: 1;
}

.card-face__border {
  z-index: 2;
  object-fit: fill;
  pointer-events: none;
}

.card-face__art.is-broken,
.card-face__border.is-broken {
  visibility: hidden;
}

/* One LANDSCAPE card (client/card-face.mjs cardLandscape; CONTRACT-ARTWORKS.md
   "Landscape frames"): the owner's 40:27 box that clips, the picture (already
   the approved window) filling it, the rank's landscape border stretched to
   exactly the box on top. Only the Party screen and the Artworks screen's
   party strip use it. Size it by ONE dimension, like a face. */
.card-land {
  position: relative;
  display: block;
  flex: none;
  box-sizing: border-box;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: var(--card-aspect, 40 / 27);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.card-land__art,
.card-land__border {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.card-land__art {
  z-index: 0;
  object-fit: cover;
  object-position: 50% 50%;
}

/* No landscape frame (an old card-frames.json): the portrait picture,
   cover-cropped, kept near its top where the faces are, and no border. */
.card-land.is-fallback .card-land__art {
  object-position: 50% 9%;
}

.card-land__border {
  z-index: 2;
  object-fit: fill;
  pointer-events: none;
}

.card-land__art.is-broken,
.card-land__border.is-broken {
  visibility: hidden;
}

/* A slot of another shape (a grid tile, a picker cell, a chip): the card at the
   largest size that fits, centred. The slot needs a definite width AND height. */
.card-fit {
  display: grid;
  place-items: center;
  container-type: size;
}

.card-fit > .card-face {
  width: 100%;
  width: min(100cqw, 100cqh * var(--card-aspect, 2 / 3));
}

/* Without container units the card takes the slot's width and the slot grows to fit it. */
@supports not (width: 1cqw) {
  .card-fit {
    aspect-ratio: auto !important;
    height: auto !important;
  }
}

/* ============================================================ card tile */

.art-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text, #e9edf8);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur-fast, 0.14s) ease, opacity var(--dur, 0.28s) ease;
}

.art-card:active {
  transform: scale(0.97);
}

/* Focus and selection ring the whole tile, clear of the card. */
.art-card:focus-visible {
  outline: 2px solid var(--accent-2, #89dfce);
  outline-offset: 5px;
}

/* The slot: every portrait card at its own shape inside the same 2:3 cell,
   standing on the cell's bottom edge so the names below line up. */
.art-card__art {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  place-items: end center;
}

.art-card__face {
  transition: transform var(--dur-fast, 0.14s) ease;
}

@media (hover: hover) {
  .art-card:hover .art-card__face {
    transform: translateY(-3px);
  }
}

/* A landscape card (Scarlet, Ivory Witch) takes two columns at the height of
   the portrait cells beside it: (two cells + the gap) wide, one cell tall. */
.art-card.is-wide {
  grid-column: span 2;
  container-type: inline-size;
}

.art-card.is-wide .art-card__art {
  aspect-ratio: auto;
  height: calc((100cqw - var(--art-gap, 10px)) * 0.75);
}

.art-card__lock {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(7, 10, 18, 0.72);
  color: var(--muted, #91a4bd);
  font-size: 18px;
  transform: translate(-50%, -50%);
}

/* The locked look: a card with no border yet, dimmed, with its lock. */
.art-card.is-locked .card-face__art {
  filter: grayscale(0.85) brightness(0.5);
  transition: filter var(--dur, 0.28s) ease;
}

.art-card.is-ready .card-face__art {
  filter: grayscale(0.15) brightness(0.78);
}

.art-card.is-ready .art-card__lock {
  color: var(--gold, #e6bd7f);
  box-shadow: 0 0 18px rgba(230, 189, 127, 0.5);
}

.art-card__info {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 0 2px;
}

.art-card__title,
.art-card__sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

/* As tall with or without the holder's portrait, so names line up across a row. */
.art-card__title {
  min-height: 22px;
}

.art-card__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.art-card__holder {
  flex: none;
  display: inline-flex;
}

.art-card__holder .portrait {
  --size: 22px;
  border-width: 1.5px;
  border-radius: 50%;
}

.art-card__styles {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 1px;
  white-space: nowrap;
}

.art-card .stars {
  font-size: 11px;
}

.art-card__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
  color: var(--muted, #91a4bd);
  font-size: 0.72rem;
  line-height: 1.3;
}

.art-card__status.is-level {
  display: grid;
  gap: 3px;
}

.art-card__status .progress {
  height: 5px;
}

.art-card__lv {
  color: var(--text, #e9edf8);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.art-card__status.is-awakened {
  color: var(--gold, #e6bd7f);
  font-weight: 800;
}

.art-card__status.is-ready {
  color: var(--gold-2, #f3d6a4);
  font-weight: 800;
}

.art-card__price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.art-card__status.is-locked {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Give mode: locked cards can't be given (a tap opens their page instead). */
.art-card.is-unavailable {
  opacity: 0.6;
}

/* Give mode: the card the hero holds now, ringed as a tile. */
.art-card.is-selected {
  outline: 2px solid var(--accent, #7bd6c1);
  outline-offset: 5px;
}

.art-card.is-selected .art-card__name {
  color: var(--accent, #7bd6c1);
}

.art-card.is-busy {
  cursor: progress;
}

.art-card.is-busy .art-card__art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 26px;
  height: 26px;
  margin: auto;
  border: 3px solid rgba(233, 237, 248, 0.3);
  border-top-color: var(--text, #e9edf8);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* =========================================================== collection */

.scr-artworks__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scr-artworks__body > .screen-header {
  margin-bottom: -4px;
}

.scr-artworks__intro {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.scr-artworks__label {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Give mode banner: stays in view while the player scrolls the cards. */
.scr-artworks__give {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--sf-accent) 55%, transparent);
  border-radius: var(--sf-radius);
  background: color-mix(in srgb, var(--sf-accent) 12%, var(--sf-surface));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.scr-artworks__give-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.scr-artworks__give-text strong {
  font-size: 1rem;
  line-height: 1.25;
}

.scr-artworks__give-text span {
  color: var(--sf-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.scr-artworks__give-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Party strip */

.scr-artworks__party {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scr-artworks__slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.scr-artworks__slot {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.scr-artworks__slot:focus-visible {
  outline: 2px solid var(--accent-2, #89dfce);
  outline-offset: 3px;
  border-radius: var(--sf-radius-sm);
}

/* Each party hero's card is a LANDSCAPE card (40:27, the equipped-artwork
   menu), at the slot's full width. */
.scr-artworks__slot-card {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 40 / 27;
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface);
  transition: transform var(--dur-fast, 0.14s) ease, box-shadow var(--dur, 0.28s) ease;
}

.scr-artworks__slot-face {
  width: 100%;
}

.scr-artworks__slot:active .scr-artworks__slot-card {
  transform: scale(0.96);
}

.scr-artworks__slot.is-open .scr-artworks__slot-card,
.scr-artworks__slot.is-empty .scr-artworks__slot-card {
  border: 2px dashed var(--sf-border-strong);
}

.scr-artworks__slot.is-open .scr-artworks__slot-card {
  border-color: color-mix(in srgb, var(--sf-accent) 55%, var(--sf-border-strong));
}

.scr-artworks__slot.is-empty {
  cursor: default;
  opacity: 0.55;
}

/* A held card fills the slot exactly (both are 40:27); the slot draws nothing around it. */
.scr-artworks__slot.has-card .scr-artworks__slot-card {
  border-radius: 0;
  background: none;
}

/* The hero being given a card: a ring clear of the card. */
.scr-artworks__slot.is-current .scr-artworks__slot-card {
  outline: 2px solid var(--sf-accent);
  outline-offset: 4px;
}

.scr-artworks__slot.is-current .scr-artworks__slot-name {
  color: var(--sf-accent);
}

.scr-artworks__slot-plus {
  color: var(--sf-accent);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.scr-artworks__slot.is-empty .scr-artworks__slot-plus {
  color: var(--sf-muted);
}

/* The hero's avatar at the card's top-left corner, mostly outside it (a
   landscape card is short). */
.scr-artworks__slot-hero {
  position: absolute;
  top: -9px;
  left: -7px;
  z-index: 3;
}

.scr-artworks__slot-hero .portrait {
  --size: 24px;
  border-width: 1.5px;
  border-radius: 50%;
}

.scr-artworks__slot-name {
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-artworks__slot-sub,
.scr-artworks__slot-lv {
  overflow: hidden;
  color: var(--sf-muted);
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-artworks__slot-lv {
  color: var(--sf-gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* What the party gains */

.scr-artworks__gains {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  background: var(--sf-surface);
}

.scr-artworks__gains-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 10px;
}

.scr-artworks__power {
  color: var(--sf-gold);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.scr-artworks__gains-empty {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.88rem;
}

.scr-artworks__gains-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scr-artworks__gain {
  display: grid;
  grid-template-columns: auto minmax(0, 5.5rem) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.scr-artworks__gain-name {
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-artworks__gain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.scr-artworks__gain-none {
  color: var(--sf-faint);
  font-size: 0.8rem;
}

/* Collection */

.scr-artworks__collection {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scr-artworks__collection-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.scr-artworks__count {
  color: var(--sf-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.scr-artworks__filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scr-artworks__chips {
  display: flex;
  gap: 8px;
  padding: 2px 0 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.scr-artworks__chips::-webkit-scrollbar {
  display: none;
}

.scr-artworks__chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--sf-border);
  border-radius: 999px;
  background: var(--sf-surface);
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.scr-artworks__chip:active {
  transform: scale(0.96);
}

.scr-artworks__chip.is-active {
  border-color: var(--sf-accent);
  background: color-mix(in srgb, var(--sf-accent) 24%, transparent);
  font-weight: 700;
}

/* Landscape cards span two columns (.art-card.is-wide); `dense` fills the hole
   one can leave at the end of a row. --art-gap is the column gap they span. */
.scr-artworks__grid {
  --art-gap: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  grid-auto-flow: row dense;
  gap: 16px var(--art-gap);
}

@media (min-width: 560px) {
  .scr-artworks__give {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .scr-artworks__give-actions {
    grid-column: auto;
  }

  .scr-artworks__gain {
    grid-template-columns: auto minmax(0, 9rem) minmax(0, 1fr);
  }
}

@media (min-width: 720px) {
  .scr-artworks__grid {
    --art-gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px var(--art-gap);
  }

  .scr-artworks__slots {
    gap: 16px;
    max-width: 860px;
  }

  .scr-artworks__slot-hero .portrait {
    --size: 30px;
  }
}

/* ============================================================ card page */

.scr-artwork {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  column-gap: 28px;
}

.scr-artwork__header {
  grid-column: 1 / -1;
  min-width: 0;
}

/* The big card (a .card-face at its own --card-aspect), sized by its width and
   short enough to leave the level and buttons in reach. */
.scr-artwork__media {
  width: min(100%, calc(72vh * var(--card-aspect, 2 / 3)));
  width: min(100%, calc(72dvh * var(--card-aspect, 2 / 3)));
  min-width: min(100%, 220px);
  margin: 0 auto;
}

/* Play / Sound, for a card that animates: over the card, above its border. */
.scr-artwork__controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.scr-artwork__controls .btn.btn-secondary {
  border-color: rgba(233, 237, 248, 0.2);
  background: rgba(7, 10, 18, 0.72);
  box-shadow: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.scr-artwork__controls .btn.btn-secondary[aria-pressed="true"] {
  border-color: var(--sf-accent);
  color: var(--sf-accent-2);
}

.scr-artwork__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin-top: 16px;
}

.scr-artwork__identity {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.scr-artwork__identity .stars {
  font-size: 1.1rem;
}

.scr-artwork__name {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
}

.scr-artwork__blurb {
  max-width: 38ch;
  margin: 0;
  color: var(--sf-muted);
  font-style: italic;
  line-height: 1.45;
}

.scr-artwork__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
}

.scr-artwork__styles {
  color: var(--sf-muted);
  font-size: 0.85rem;
}

.scr-artwork__panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  background: var(--sf-surface);
}

.scr-artwork__label {
  color: var(--sf-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scr-artwork__panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 8px;
}

.scr-artwork__at {
  color: var(--sf-gold);
  font-size: 0.8rem;
  font-weight: 700;
}

.scr-artwork__muted {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

/* Level */

.scr-artwork__level-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
}

.scr-artwork__level-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.scr-artwork__level-num {
  display: inline-block;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.scr-artwork__level-cap {
  color: var(--sf-muted);
}

.btn.scr-artwork__level-btn {
  flex: 1 1 200px;
  max-width: 100%;
}

.scr-artwork__awakened {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sf-gold);
  font-weight: 800;
}

.scr-artwork__note {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.scr-artwork__note.is-ready {
  color: var(--sf-good);
  font-weight: 700;
}

.scr-artwork__note.is-short {
  color: var(--sf-warn);
}

.scr-artwork__note.is-max {
  color: var(--sf-gold);
  font-weight: 700;
}

.scr-artwork__level.is-up {
  animation: sf-panel-glow 0.9s ease-out;
}

.scr-artwork__level.is-up .scr-artwork__level-num {
  color: var(--sf-gold);
  animation: sf-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes sf-panel-glow {
  0% { box-shadow: 0 0 0 0 rgba(230, 189, 127, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(230, 189, 127, 0); }
}

@keyframes sf-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Borders: the card's five rank borders on this very card, the one it wears
   marked under it. A landscape card's ladder wraps (three, then two). */
.scr-artwork__ladder {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 12px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scr-artwork__borders.is-wide .scr-artwork__ladder {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.scr-artwork__rung {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.scr-artwork__rung-face {
  width: 100%;
  max-width: 120px;
}

.scr-artwork__rung-label {
  color: var(--sf-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scr-artwork__rung.is-ahead .scr-artwork__rung-label {
  color: var(--sf-faint);
  font-weight: 600;
}

.scr-artwork__rung.is-current .scr-artwork__rung-label {
  color: var(--sf-gold-2);
}

.scr-artwork__rung-now {
  visibility: hidden;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sf-gold) 22%, transparent);
  color: var(--sf-gold);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scr-artwork__rung.is-current .scr-artwork__rung-now {
  visibility: visible;
}

.scr-artwork__ladder-note {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Holder */

.scr-artwork__who {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface-2);
  text-align: left;
  cursor: pointer;
}

.scr-artwork__who:hover {
  border-color: var(--sf-accent);
}

.scr-artwork__who-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.scr-artwork__who-name {
  overflow: hidden;
  font-size: 1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-artwork__who-note {
  color: var(--sf-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.scr-artwork__sig {
  color: var(--sf-gold);
  font-size: 0.8rem;
  font-weight: 700;
}

.scr-artwork__chevron {
  color: var(--sf-muted);
}

.scr-artwork__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scr-artwork__actions .btn {
  flex: 1 1 140px;
}

/* Holder bonus */

.scr-artwork__stats {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scr-artwork__stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--sf-surface-2);
  font-variant-numeric: tabular-nums;
}

.scr-artwork__stat-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.scr-artwork__stat-now {
  font-weight: 800;
}

.scr-artwork__stat-arrow {
  color: var(--sf-faint);
}

.scr-artwork__stat-next {
  color: var(--sf-good);
  font-weight: 800;
}

.scr-artwork__full {
  margin: 0;
  color: var(--sf-gold-2);
  font-size: 0.82rem;
  line-height: 1.4;
}

.scr-artwork__signature {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--sf-border);
}

.scr-artwork__signature.is-none {
  color: var(--sf-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.scr-artwork__sig-line {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.scr-artwork__sig-line strong {
  color: var(--sf-gold);
}

.scr-artwork__voxels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scr-artwork__voxel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface-2);
  text-align: left;
  cursor: pointer;
}

.scr-artwork__voxel:hover {
  border-color: var(--sf-accent);
}

.scr-artwork__voxel.is-missing {
  opacity: 0.72;
}

.scr-artwork__voxel.is-holding {
  border-color: var(--sf-gold);
}

.scr-artwork__voxel-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.scr-artwork__voxel-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-artwork__voxel-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}

.scr-artwork__voxel-note {
  color: var(--sf-muted);
  font-size: 0.75rem;
}

.scr-artwork__voxel.is-holding .scr-artwork__voxel-note {
  color: var(--sf-gold);
  font-weight: 700;
}

/* Party skill */

.scr-artwork__skill-name {
  margin: 0;
  color: var(--sf-violet);
  font-size: 1.15rem;
}

.scr-artwork__parts {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scr-artwork__part {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface-2);
}

.scr-artwork__part p {
  margin: 0;
}

.scr-artwork__part-text {
  font-weight: 700;
  line-height: 1.4;
}

.scr-artwork__part-who {
  color: var(--sf-muted);
  font-size: 0.8rem;
}

.scr-artwork__part-party {
  color: var(--sf-accent);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

.scr-artwork__active {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.85rem;
}

.scr-artwork__active.is-on {
  color: var(--sf-good);
  font-weight: 700;
}

/* "Give to…" dialog */

.scr-artwork__picker {
  display: grid;
  gap: 8px;
  color: var(--sf-text);
}

.scr-artwork__picker-hint {
  margin: 0;
  color: var(--sf-muted);
  font-size: 0.85rem;
}

.scr-artwork__picker-label {
  margin: 8px 0 0;
  color: var(--sf-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scr-artwork__picker-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scr-artwork__pick {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface);
  text-align: left;
  cursor: pointer;
}

.scr-artwork__pick:hover:not(:disabled) {
  border-color: var(--sf-accent);
}

.scr-artwork__pick:disabled {
  cursor: default;
  opacity: 0.6;
}

.scr-artwork__pick-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.scr-artwork__pick-name {
  overflow: hidden;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-artwork__pick-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sf-muted);
  font-size: 0.75rem;
}

.scr-artwork__pick-note {
  color: var(--sf-muted);
  font-size: 0.75rem;
}

.scr-artwork__pick-sig {
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sf-gold) 20%, transparent);
  color: var(--sf-gold);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (min-width: 860px) {
  .scr-artwork {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  .scr-artwork__media {
    position: sticky;
    top: 16px;
  }

  .scr-artwork__body {
    margin-top: 0;
  }

  .scr-artwork__identity {
    justify-items: start;
    text-align: left;
  }

  .scr-artwork__tags {
    justify-content: flex-start;
  }
}

/* ================================================= hub, party and hero */

.scr-hub__tile--artworks {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(230, 189, 127, 0.22), transparent 60%),
    radial-gradient(110% 120% at 0% 100%, rgba(171, 146, 238, 0.16), transparent 60%),
    var(--sa-surface, #141e2e);
}

/* Party, FGO style: under each hero, the card they hold as a LANDSCAPE card
   (client/card-face.mjs cardLandscape) at the slot's full width, its name
   and level under it; or an empty 40:27 frame with "+ Artwork". The button
   draws nothing around the card; focus is a ring clear of it. */
.scr-party__art {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--sb-text, #e9edf8);
  font: inherit;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.scr-party__art:focus-visible {
  outline: 2px solid var(--accent-2, #89dfce);
  outline-offset: 3px;
}

.scr-party__art:active .scr-party__art-card,
.scr-party__art:active .scr-party__art-frame {
  transform: scale(0.97);
}

.scr-party__art.is-busy {
  cursor: progress;
  opacity: 0.6;
}

/* The landscape card: the slot's full width; its aspect-ratio gives the height. */
.scr-party__art-card {
  width: 100%;
}

/* No card: an empty 40:27 frame (border included), dashed, "+ Artwork". */
.scr-party__art-frame {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1px;
  width: 100%;
  aspect-ratio: 40 / 27;
  border: 1px dashed color-mix(in srgb, var(--sb-accent, #7bd6c1) 55%, var(--sb-border, #29364c));
  border-radius: 4px;
  background: color-mix(in srgb, var(--sb-accent, #7bd6c1) 6%, transparent);
  color: var(--sb-muted, #91a4bd);
  transition: background var(--dur-fast, 0.14s) ease, border-color var(--dur-fast, 0.14s) ease;
}

.scr-party__art:hover .scr-party__art-frame {
  border-color: var(--sb-accent, #7bd6c1);
  background: color-mix(in srgb, var(--sb-accent, #7bd6c1) 14%, transparent);
}

.scr-party__art-plus {
  color: var(--sb-accent, #7bd6c1);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.scr-party__art-add {
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.1;
}

/* The label: the card's name, then its level (two lines in a narrow slot,
   "Name · Lv 3" once there is room). A blank one keeps its height. */
.scr-party__art-label {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.scr-party__art-label.is-blank {
  visibility: hidden;
}

.scr-party__art-name {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scr-party__art-lv {
  color: var(--sb-gold, #e6bd7f);
  font-size: 0.64rem;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 560px) {
  .scr-party__art-label {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
  }

  .scr-party__art-name {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 0.76rem;
  }

  .scr-party__art-lv {
    flex: none;
    font-size: 0.72rem;
  }

  .scr-party__art-lv::before {
    content: '·';
    margin-right: 5px;
    color: var(--sb-muted, #91a4bd);
  }

  .scr-party__art-plus {
    font-size: 1.35rem;
  }

  .scr-party__art-add {
    font-size: 0.72rem;
  }
}

/* Hero page: the card slot (the held card at its rank, or an empty card
   frame with a "+"), Change / Take back, the signature card. */
.scr-hero__artwork {
  justify-items: start;
}

.scr-hero__art {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scr-hero__art:focus-visible {
  outline: 2px solid var(--accent-2, #89dfce);
  outline-offset: 4px;
}

.scr-hero__art:disabled {
  cursor: default;
  opacity: 0.6;
}

/* A landscape card gets a wider slot, at the same height. */
.scr-hero__art.is-wide {
  grid-template-columns: 176px minmax(0, 1fr) auto;
}

.scr-hero__art-slot {
  width: 100%;
  height: 144px;
}

/* The empty slot: an obvious empty card, dashed, with a "+". */
.scr-hero__art-slot.is-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  border: 2px dashed color-mix(in srgb, var(--accent, #7bd6c1) 55%, var(--border-strong, #3a4b68));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #7bd6c1) 7%, transparent);
  transition: background var(--dur-fast, 0.14s) ease, border-color var(--dur-fast, 0.14s) ease;
}

.scr-hero__art:hover .scr-hero__art-slot.is-empty {
  border-color: var(--accent, #7bd6c1);
  background: color-mix(in srgb, var(--accent, #7bd6c1) 14%, transparent);
}

.scr-hero__art-plus {
  color: var(--accent, #7bd6c1);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.scr-hero__art-add {
  color: var(--muted, #91a4bd);
  font-size: 0.72rem;
  font-weight: 700;
}

.scr-hero__art-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.scr-hero__art-name {
  font-size: 1.05rem;
}

.scr-hero__art-lv {
  color: var(--sb-gold, #e6bd7f);
  font-size: 0.85rem;
  font-weight: 700;
}

.scr-hero__art-bonus {
  color: var(--sb-muted, #91a4bd);
  font-size: 0.82rem;
  line-height: 1.35;
}

.scr-hero__art-chevron {
  color: var(--sb-muted, #91a4bd);
}

.scr-hero__art-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* The card picker (client/card-picker.mjs): the Party screen's slots and the
   hero page's card slot and Change open it. PORTRAIT cards (the owner: the
   landscape ones are only for the compact party menus). A ui.modal on
   <body>: global tokens only. */
.card-picker {
  display: grid;
  gap: 12px;
}

.card-picker__hint {
  margin: 0;
  color: var(--muted, #91a4bd);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* The card the hero holds now, with Take it back. */
.card-picker__current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--border, #29364c);
  border-radius: 10px;
  background: var(--panel-2, #1a2639);
}

.card-picker__current-text {
  min-width: 0;
  color: var(--muted, #91a4bd);
  font-size: 0.86rem;
}

.card-picker__current-text strong {
  color: var(--text, #e9edf8);
}

.card-picker__grid {
  --cards-gap: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  grid-auto-flow: row dense;
  gap: 16px var(--cards-gap);
  margin: 0;
  padding: 6px;
  list-style: none;
}

.card-picker__grid > li {
  min-width: 0;
}

/* A landscape card (Scarlet, Ivory Witch) spans two cells, one cell tall. */
.card-picker__grid > li.is-wide {
  grid-column: span 2;
}

.card-picker__card {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text, #e9edf8);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  container-type: inline-size;
}

.card-picker__card:focus-visible {
  outline: 2px solid var(--accent-2, #89dfce);
  outline-offset: 4px;
}

.card-picker__card:active:not(:disabled) {
  transform: scale(0.97);
}

.card-picker__card:disabled {
  cursor: default;
}

/* The card the hero holds now: marked with a ring clear of the card. */
.card-picker__card.is-current {
  outline: 2px solid var(--accent, #7bd6c1);
  outline-offset: 4px;
}

.card-picker__art {
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 4px;
  place-items: end center;
}

.card-picker__card.is-wide .card-picker__art {
  aspect-ratio: auto;
  height: calc((100cqw - var(--cards-gap, 10px)) * 0.75);
}

.card-picker__name {
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-picker__lv {
  color: var(--gold, #e6bd7f);
  font-size: 0.72rem;
  font-weight: 700;
}

.card-picker__note {
  color: var(--warn, #f2c46d);
  font-size: 0.7rem;
  line-height: 1.25;
}

.card-picker__card.is-current .card-picker__note {
  color: var(--accent, #7bd6c1);
  font-weight: 700;
}

.card-picker__foot {
  display: flex;
  justify-content: flex-end;
}

.card-picker.is-empty {
  justify-items: start;
}

/* Room for more cards at once on a wide screen. */
@media (min-width: 760px) {
  .modal.card-picker-modal {
    max-width: 680px;
  }
}

.scr-hero__art-sig {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.scr-hero__art-sig strong {
  color: var(--sb-gold, #e6bd7f);
}

.scr-hero__art-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-2, #89dfce);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ======================================================= reduced motion */

@media (prefers-reduced-motion: reduce) {
  .art-card,
  .art-card__face,
  .art-card .card-face__art,
  .card-picker__card,
  .scr-party__art-frame,
  .scr-artworks__slot-card,
  .scr-artwork__level.is-up,
  .scr-artwork__level.is-up .scr-artwork__level-num {
    animation: none !important;
    transition: none !important;
  }
}
