/*
 * TAG Legal Desk v2.1, J140 (28 Sep 2026): the trophy room (js\v21_trophy.js). Game art: every piece carries
 * data-v21="game", so the core's quiet rule hides it while a welfare message is open, in the quiet period and under
 * the nobody band. The pile's glints and the shine on rare and legendary finds stand still under reduced motion, Calm
 * and the days that matter. Colours are the desk's theme tokens, with the pile's brass and leaf set again for Dark and
 * High contrast. Custom properties come through the CSSOM (--v21tr-sw, --v21tr-d); nothing here needs a style attribute.
 * The crew strip's own rules (spread out, blurred when offline) live in styles\desk.css beside the header.
 * J163 (29 Sep 2026, the Director: "think the trophy room may be busted too a bit"): the room lays itself out by its own
 * width (the side sheet is 560 px at most, the whole window on a small screen): the two cards at the top stand side by side
 * where there is room and one above the other where there is not; what they wear is a card with the picture on top
 * (the avatar always at the 96 px it is drawn at, so its frame sits on it, never shrunk under it); every item keeps
 * its whole name on a line or two, with its marks under the name, never squeezed to one letter a line; the practice
 * leaf sits beside its words. A name in Stats is a button that opens that person's room (.v21tr-who-b).
 */

.v21tr {
  --v21tr-face: #C9A24E; --v21tr-rim: #8A6A2A; --v21tr-leaf: #4F7A55; --v21tr-vein: #2F4F35; --v21tr-glint: #FFF6D8;
  --v21tr-ground: color-mix(in srgb, var(--ink) 14%, transparent);
  --v21tr-rare: #1D6FB8; --v21tr-legend: #A67C00;
  display: grid; gap: 14px;
}
:root[data-theme="dark"] .v21tr, :root[data-v21-theme="night_shift"] .v21tr {
  --v21tr-face: #D8B461; --v21tr-rim: #9C7A33; --v21tr-leaf: #7FB08A; --v21tr-vein: #2C4A33; --v21tr-glint: #FFF3C4;
  --v21tr-ground: color-mix(in srgb, #000 40%, transparent);
  --v21tr-rare: #7DB8F0; --v21tr-legend: #F2CB4C;
}
:root[data-theme="high_contrast"] .v21tr {
  --v21tr-face: #FFFFFF; --v21tr-rim: #000000; --v21tr-leaf: #000000; --v21tr-vein: #FFFFFF; --v21tr-glint: #FFFFFF;
  --v21tr-ground: #000000; --v21tr-rare: #00367A; --v21tr-legend: #000000;
}
@supports not (color: color-mix(in srgb, red 14%, white)) { .v21tr { --v21tr-ground: rgba(0,0,0,.14); } }

.v21tr-sec { padding: 14px 16px; border-radius: var(--r-card, 16px); min-width: 0; }
.v21tr-sec > p { overflow-wrap: break-word; }
.v21tr-sec > h3 { margin: 0 0 10px; font-size: 1rem; }
.v21tr-sec h4 { margin: 10px 0 6px; font-size: .8125rem; font-weight: 700; color: var(--ink-2); letter-spacing: .04em; text-transform: uppercase; }
.v21tr-sec p { margin: 4px 0; }

/* ---------- the hero: what they wear, beside the pile (one above the other where the room is narrow) ---------- */
.v21tr-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; align-items: stretch; }
.v21tr-look { display: grid; justify-items: center; gap: 8px; min-width: 0; text-align: center; }
/* the avatar at the size it is drawn, with room round it for the frame drawn for that size */
.v21tr-look > .av { width: 96px; height: 96px; font-size: 2rem; flex: none; margin: 8px; }
.v21tr-look > .av .dot { display: none; }
.v21tr-who { min-width: 0; max-width: 100%; display: grid; justify-items: center; gap: 2px; }
.v21tr-name { font-size: 1.25rem; font-weight: 700; margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.v21tr-stage { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--ink-2); }
.v21tr-lines { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; justify-self: stretch; font-size: .875rem; text-align: left; }
.v21tr-lines li { overflow-wrap: break-word; }

/* ---------- the Leaf Token pile ---------- */
.v21tr-pilesec { text-align: center; }
.v21tr-pile { display: grid; place-items: center; }
.v21tr-pilesvg { display: block; width: 100%; max-width: 220px; height: auto; overflow: visible; }
.v21tr-pilesvg .v21tr-ground { fill: var(--v21tr-ground); }
.v21tr-tok .tk-rim { fill: var(--v21tr-rim); }
.v21tr-tok .tk-face { fill: var(--v21tr-face); stroke: var(--v21tr-rim); stroke-width: .8; }
.v21tr-tok .tk-leaf { fill: var(--v21tr-leaf); }
.v21tr-tok .tk-vein { fill: none; stroke: var(--v21tr-vein); stroke-width: .6; stroke-linecap: round; }
.v21tr-tok.is-glint .tk-face { animation: v21tr-glint 3.6s ease-in-out infinite; animation-delay: var(--v21tr-d, 0s); }
@keyframes v21tr-glint { 0%, 70%, 100% { fill: var(--v21tr-face); } 82% { fill: var(--v21tr-glint); } }
.v21tr-big { font-size: 1.375rem; font-weight: 700; margin: 6px 0 0; color: var(--ink); }

/* ---------- items, pins, keepsakes ---------- */
/* An item is its face, then its name, then its marks (Wearing, rare) under the name: the name keeps the whole width
   beside the face, so it never folds to one letter a line. One column where the room is narrow. */
.v21tr-items, .v21tr-pins, .v21tr-hons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.v21tr-pins { grid-template-columns: repeat(auto-fill, minmax(min(100%, 124px), 1fr)); }
.v21tr-hons { grid-template-columns: 1fr; }
.v21tr-item, .v21tr-keep, .v21tr-pin { position: relative; min-width: 0; padding: 8px 10px; border-radius: 12px; background: var(--glass-1); border: 1px solid var(--glass-edge); overflow: hidden; }
.v21tr-item, .v21tr-keep { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 4px; }
.v21tr-pin { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.v21tr-iname { min-width: 0; font-size: .875rem; font-weight: 600; overflow-wrap: break-word; }
.v21tr-face { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--solid); color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--glass-edge); }
.v21tr-face.is-swatch { background: var(--v21tr-sw, var(--brand)); }
/* J163 review: an item's own picture where the desk can draw it (a frame round your animal at 32 px, the smallest size a
   frame is drawn for; a tree type; a small Wren wearing the piece): no disc behind it, room round it for the frame. */
.v21tr-face.is-pic { width: 40px; height: 40px; border-radius: 0; background: none; box-shadow: none; overflow: visible; }
/* the frame is drawn round a 32 px avatar in a 49 px box: at 80 percent it sits inside the picture's 40 px */
.v21tr-face.is-pic > .av { flex: none; transform: scale(.8); }
.v21tr-face.is-pic > svg, .v21tr-face.is-pic > img { display: block; width: 40px; height: 40px; }
.v21tr-face.is-pic > .v21st-prev { display: flex; align-items: flex-end; justify-content: center; width: 40px; height: 40px; min-height: 0; }
/* a tree's picture has air round it: drawn a little larger, centred on the picture's place */
.v21tr-face.is-pic > .v21st-prev .v21st-prev-leaf { width: 40px; height: 40px; align-items: center; overflow: visible; }
.v21tr-face.is-pic > .v21st-prev img { width: 48px; height: 48px; max-width: none; margin: -6px -4px -2px; object-fit: contain; }
.v21tr-medal { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--solid); color: var(--brand-text); box-shadow: inset 0 0 0 2px var(--edge-strong); }
.v21tr-tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.v21tr-tag { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); background: var(--solid); box-shadow: inset 0 0 0 1px var(--edge-strong); white-space: nowrap; }
.v21tr-tag.is-rare { box-shadow: inset 0 0 0 1.5px var(--v21tr-rare); }
.v21tr-tag.is-legendary { box-shadow: inset 0 0 0 1.5px var(--v21tr-legend); }
.v21tr-item.is-worn { border-color: var(--brand-text); }
.v21tr-hon { display: flex; align-items: center; gap: 8px; }
.v21tr-prac p { display: flex; align-items: center; gap: 8px; }
.v21tr-prac p > svg { flex: none; }
.v21tr-ribbon { color: var(--v21tr-legend); display: inline-flex; }
.v21tr-boost { font-weight: 700; }

/* Rare and legendary finds shine: a soft rim and a light that sweeps across now and then. */
.v21tr-item[data-rarity="rare"] { box-shadow: inset 0 0 0 1.5px var(--v21tr-rare); }
.v21tr-item[data-rarity="legendary"], .v21tr-keep.is-legendary { box-shadow: inset 0 0 0 1.5px var(--v21tr-legend), inset 0 0 16px color-mix(in srgb, var(--v21tr-legend) 14%, transparent); }
.v21tr-item[data-rarity]::after, .v21tr-keep.is-legendary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  animation: v21tr-sheen 5.5s ease-in-out infinite;
}
.v21tr-item[data-rarity="legendary"]::after, .v21tr-keep.is-legendary::after { animation-duration: 4s; }
@keyframes v21tr-sheen { 0%, 72% { transform: translateX(0); } 100% { transform: translateX(420%); } }
.v21tr-best.is-legendary, .v21tr-best.is-rare { font-weight: 700; }

/* ---------- the room's quiet lines ---------- */
.v21tr-more { font-style: italic; }

/* ---------- Profile: the button at the top ---------- */
.v21tr-ptop { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--r-card, 16px); }
.v21tr-ptop h3 { margin: 0; font-size: 1rem; }
.v21tr-ptop p { margin: 2px 0 0; }
.v21tr-ptop .btn { flex: none; }

/* ---------- stillness: reduced motion, Calm, the days that matter, High contrast ---------- */
:root[data-motion="reduced"] .v21tr-tok .tk-face, :root[data-calm="on"] .v21tr-tok .tk-face, :root[data-day-matters] .v21tr-tok .tk-face,
:root[data-theme="high_contrast"] .v21tr-tok .tk-face { animation: none; }
:root[data-motion="reduced"] .v21tr [data-rarity]::after, :root[data-calm="on"] .v21tr [data-rarity]::after, :root[data-day-matters] .v21tr [data-rarity]::after,
:root[data-theme="high_contrast"] .v21tr [data-rarity]::after,
:root[data-motion="reduced"] .v21tr .is-legendary::after, :root[data-calm="on"] .v21tr .is-legendary::after, :root[data-day-matters] .v21tr .is-legendary::after,
:root[data-theme="high_contrast"] .v21tr .is-legendary::after { animation: none; display: none; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .v21tr-tok .tk-face { animation: none; }
  :root:not([data-motion="full"]) .v21tr [data-rarity]::after, :root:not([data-motion="full"]) .v21tr .is-legendary::after { animation: none; display: none; }
}
:root[data-theme="high_contrast"] .v21tr-item, :root[data-theme="high_contrast"] .v21tr-keep, :root[data-theme="high_contrast"] .v21tr-pin { background: #FFFFFF; border: 2px solid #000000; }
:root[data-theme="high_contrast"] .v21tr-item[data-rarity], :root[data-theme="high_contrast"] .v21tr-keep.is-legendary { border-width: 3px; box-shadow: none; }
@media (forced-colors: active) {
  .v21tr-tok .tk-face { fill: Canvas; stroke: CanvasText; }
  .v21tr-tok .tk-rim, .v21tr-tok .tk-leaf { fill: CanvasText; }
  .v21tr-item, .v21tr-keep, .v21tr-pin { border: 1px solid CanvasText; }
  .v21tr [data-rarity]::after, .v21tr .is-legendary::after { display: none; }
}

/* ---------- welfare first (belt and braces with the core's own quiet rule) ---------- */
:root[data-quiet="on"] .v21tr, :root[data-quiet="on"] .v21tr-ptop { display: none !important; }
@media print { .v21tr, .v21tr-ptop { display: none !important; } }

/* ---------- narrow screens: Profile's button goes under its words ---------- */
@media (max-width: 599px) {
  .v21tr-ptop { flex-direction: column; align-items: flex-start; }
}

/* ---------- Stats: a person's name opens their room (js\v21_stats.js asks for trophy.nameButton) ---------- */
.v21tr-who-b { display: inline; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-align: left; white-space: nowrap; cursor: pointer; }
.v21tr-who-b > .av { vertical-align: middle; margin-right: 8px; }
/* a faint dotted line says the name opens something before it is hovered (as the bonus headings' tooltips do) */
.v21tr-who-b > .ell { display: inline-block; max-width: 150px; vertical-align: middle; text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
.v21tr-who-b:hover > .ell { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
@supports not (color: color-mix(in srgb, red 45%, white)) { .v21tr-who-b > .ell { text-decoration-color: currentColor; } }
/* Stats' own small screen rule for the name (.v21s-who > .ell, 96 px) holds inside the button too */
@media (max-width: 600px) { .v21tr-who-b > .ell { max-width: 96px; } }
.v21tr-who-b:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (forced-colors: active) { .v21tr-who-b:focus-visible { outline-color: Highlight; } }

/* ---------- J163 review: a long room scrolls from the keyboard (its body takes focus after Close) ---------- */
.v21tr-sheet .sheet-b:focus { outline: none; }
.v21tr-sheet .sheet-b:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
@media (forced-colors: active) { .v21tr-sheet .sheet-b:focus-visible { outline-color: Highlight; } }
