/*
 * TAG Legal Desk v2.1, wp4_craft: C1 Sharp Eye, C2 the Badge Book, C3 Weekly Team Quests, C4 Boss Battles.
 * Desk tokens only (styles/desk.css), so Light, Dark, Eucalypt, Harbour and High contrast all read as the bible
 * sets them. Only transform and opacity animate; reduced motion, the Motion setting and Calm turn every move into a
 * 120 ms fade or a still. Every game element carries data-v21="game" and hides with the core's quiet attribute.
 * No element here is ever inside the white email paper, on a board card or on the welfare path.
 */

/* ---------- the quiet rule, belt and braces with styles/v21_core.css ---------- */
:root[data-quiet="on"] .v21c-boss, :root[data-quiet="on"] .v21c-quests, :root[data-quiet="on"] .v21c-toast,
:root[data-quiet="on"] .v21c-reveal, :root[data-quiet="on"] .v21c-win, :root[data-quiet="on"] .v21c-win-line { display: none !important; }

/* ---------- C1 Sharp Eye: the stamp, the toast, the Profile section ---------- */
.v21c-stamp { display: inline-grid; place-items: center; flex: none; border-radius: 50%; }
.v21c-stamp.is-icon { background: var(--brand-soft); color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--glass-rim); }
.v21c-s20 { width: 20px; height: 20px; }
.v21c-s24 { width: 24px; height: 24px; }
.v21c-s48 { width: 48px; height: 48px; }
.v21c-stamp.is-art svg { width: 100%; height: 100%; }

.v21c-toast { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; margin: 0 0 12px; border-radius: 16px; max-width: 100%; box-sizing: border-box; }
.v21c-toast .msg { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: .9375rem; line-height: 1.3; }
.v21c-toast .v21c-tok { flex: none; font-size: .75rem; font-weight: 700; color: var(--brand-text); padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); white-space: nowrap; }
.v21c-toast .btn { flex: none; }

.v21c-se-row { display: flex; align-items: center; gap: 14px; }
.v21c-se-row p { margin: 0; }
.v21c-se-n { font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.v21c-se-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.v21c-se-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .9375rem; }
.v21c-se-list li .meta { flex: none; }

/* ---------- C2 the Badge Book ---------- */
.v21c-count { margin: -4px 0 0; }
.v21c-pins { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.v21c-pinbtn { display: grid; justify-items: center; align-content: start; gap: 6px; width: 100%; min-height: 44px; padding: 8px 4px; border: 0; border-radius: 14px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.v21c-pinbtn:hover { background: var(--glass-hover); }
.v21c-pinbtn[aria-expanded="true"] { background: var(--brand-soft); }
.v21c-pinbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.v21c-pinbtn .nm { font-size: .75rem; line-height: 1rem; text-align: center; color: var(--ink-2); overflow-wrap: anywhere; }
.v21c-pinbtn.is-earned .nm { color: var(--ink); font-weight: 600; }

.v21c-pin { display: inline-grid; place-items: center; flex: none; border-radius: 50%; box-sizing: border-box; }
.v21c-pin.v21c-px48 { width: 48px; height: 48px; }
.v21c-pin.v21c-px96 { width: 96px; height: 96px; }
.v21c-pin.v21c-px160 { width: 160px; height: 160px; }
.v21c-pin.is-earned { background: var(--brand-soft); color: var(--brand-text); box-shadow: inset 0 0 0 2px var(--accent), inset 0 1px 0 var(--glass-hi); }
.v21c-pin.is-earned.m-gold { box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 5px var(--glass-1), inset 0 0 0 7px var(--accent); }
.v21c-pin.is-earned.m-silver { box-shadow: inset 0 0 0 3px var(--accent), inset 0 1px 0 var(--glass-hi); }
.v21c-pin.is-locked { background: var(--glass-1); color: var(--ink-3); border: 2px dashed var(--edge-strong); }
.v21c-pin.m-rem { background: var(--solid-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--edge-strong); }
.v21c-pin-art.v21c-px160 > svg { max-width: 100%; height: auto; }

.v21c-detail { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 16px; border-radius: var(--r-card); }
.v21c-detail[hidden] { display: none; }
.v21c-detail-words h4 { margin: 0 0 4px; font-size: 1.0625rem; }
.v21c-detail-words p { margin: 0 0 4px; }
.v21c-rem-h { margin-top: 8px; }
.v21c-rem-pin { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; text-align: center; font-size: .75rem; }
.v21c-rem-pin .nm { color: var(--ink); font-weight: 600; }

.v21c-reveal { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; min-width: 0; max-width: 100%; }
.v21c-reveal h2 { margin: 0 0 4px; font-size: 1.375rem; line-height: 1.75rem; }
.v21c-reveal p { margin: 0 0 6px; }
.v21c-kicker { font-size: .75rem !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.v21c-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.v21c-pin.is-revealing { animation: v21c-pin-in var(--t-move, 420ms) var(--ease-pop, cubic-bezier(.34,1.4,.64,1)) both; }
@keyframes v21c-pin-in { 0% { transform: scale(.8); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.v21c-fadein { animation: v21c-fade 120ms linear both; }
@keyframes v21c-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- C3 Weekly Team Quests (a tile in the rail at L, #v21-foot below) ---------- */
.v21c-quests { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r-card); box-sizing: border-box; max-width: 100%; }
.v21c-qhead { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: 0 4px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.v21c-qhead:hover { background: var(--glass-hover); }
.v21c-qhead:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.v21c-qhead .t { font-weight: 700; font-size: 1rem; }
.v21c-qhead .v21c-qcount { flex: 1 1 auto; min-width: 0; }
.v21c-qhead .v21c-chev { flex: none; color: var(--ink-3); transition: transform var(--t-small) var(--ease-out); }
.v21c-qhead[aria-expanded="true"] .v21c-chev { transform: rotate(180deg); }
.v21c-qbody[hidden] { display: none; }
.v21c-qbody p { margin: 6px 0 0; }

.v21c-track { position: relative; height: 24px; margin: 0 4px; }
.v21c-track .line { position: absolute; left: 8%; right: 8%; top: 11px; height: 2px; border-radius: 2px; background: var(--edge-strong); opacity: .5; }
.v21c-track .mk { position: absolute; top: 2px; width: 20px; height: 20px; border-radius: 50%; box-sizing: border-box; border: 2px solid var(--edge-strong); background: var(--solid); display: grid; place-items: center; transform: translateX(-50%); }
.v21c-track .mk:nth-of-type(1) { left: 16.6%; }
.v21c-track .mk:nth-of-type(2) { left: 50%; }
.v21c-track .mk:nth-of-type(3) { left: 83.4%; }
.v21c-track .mk.is-done { background: var(--accent); border-color: var(--accent); color: var(--solid); }
.v21c-track .mk.is-faded { opacity: .45; }
.v21c-track .mk.just-done { animation: v21c-pop 160ms var(--ease-pop, cubic-bezier(.34,1.4,.64,1)) both; }
@keyframes v21c-pop { from { transform: translateX(-50%) scale(.8); opacity: .4; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.v21c-track-art { margin: 0 4px; }

.v21c-ql { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.v21c-ql li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 10px; align-items: start; font-size: .9375rem; line-height: 1.35; }
.v21c-ql .v21c-qg { width: 20px; height: 20px; color: var(--brand-text); margin-top: 1px; }
.v21c-ql .w { grid-column: 2; display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; color: var(--ink-2); }
.v21c-ql li.is-done .w { color: var(--brand-text); font-weight: 600; }
.v21c-ql li.is-resting { opacity: .6; }

/* ---------- C4 Boss Battles: the header bar, the win ----------
   The core's header slot (.v21-hbar) is a 6 px strip absolutely placed under the count. The bar fills it; the boss at
   28 px sits beside the count on the board (art only); the boss's name (words, before the art passes) and
   "{ai} chipped in 38" sit beside the bar on wide screens only. Inside a job only the bar shows. */
.v21c-boss { position: relative; display: block; width: 100%; height: 6px; }
.v21c-boss[hidden] { display: none !important; }
.v21c-bar { position: absolute; inset: 0; border-radius: 999px; overflow: hidden; background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--glass-rim); }
.v21c-bar .fill { position: absolute; inset: 0; transform-origin: left center; background: var(--accent); border-radius: inherit; transition: transform var(--t-move, 420ms) var(--ease-glide, cubic-bezier(.22,1,.36,1)); }
.v21c-bar.is-hit { animation: v21c-hit 180ms var(--ease-out, ease-out) both; }
@keyframes v21c-hit { 50% { opacity: .55; } }
.v21c-boss-face { position: absolute; right: calc(100% + 10px); bottom: -4px; width: 28px; height: 28px; display: grid; place-items: center; }
.v21c-boss:not(.has-art) .v21c-boss-face { display: none; }
.v21c-boss-name, .v21c-boss-ai { position: absolute; bottom: -5px; font-size: .6875rem; line-height: 1rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; letter-spacing: 0; }
.v21c-boss-name { right: calc(100% + 10px); }
.v21c-boss.has-art .v21c-boss-name { display: none; }
.v21c-boss-ai { left: calc(100% + 10px); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.v21c-boss-ai:empty { display: none; }
.v21c-boss.in-job .v21c-boss-face, .v21c-boss.in-job .v21c-boss-name, .v21c-boss.in-job .v21c-boss-ai { display: none; }
@media (max-width: 1099px) { .v21c-boss-name, .v21c-boss-ai { display: none; } }
@media (max-width: 1023px) { .v21c-boss-face { display: none !important; } }

.v21c-win { display: grid; justify-items: center; gap: 6px; text-align: center; max-width: 100%; }
.v21c-win h2 { margin: 0; }
.v21c-win p { margin: 0; }
.v21c-win-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); }
.v21c-win.has-art .gb-win { box-shadow: none; background: transparent; border: 0; }
.v21c-win-line { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; font-weight: 600; color: var(--brand-text); }

/* ---------- High contrast ---------- */
:root[data-theme="high_contrast"] .v21c-bar { box-shadow: inset 0 0 0 1px #000000; background: #FFFFFF; }
:root[data-theme="high_contrast"] .v21c-pin.is-earned { box-shadow: inset 0 0 0 2px #000000; }
:root[data-theme="high_contrast"] .v21c-track .line { opacity: 1; }
:root[data-theme="high_contrast"] .v21c-toast { border-width: 2px; }

/* ---------- Narrow screens (XS 360 to 599): nothing runs past 390 px ---------- */
@media (max-width: 599px) {
  .v21c-detail, .v21c-reveal { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .v21c-detail .v21c-px160, .v21c-detail .v21c-pin-art > svg { width: 112px; height: 112px; }
  .v21c-reveal .v21c-px96, .v21c-reveal .v21c-pin-art > svg { width: 72px; height: 72px; }
  .v21c-toast { flex-wrap: wrap; }
  .v21c-pins { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}

/* ---------- Reduced motion, the Motion setting and Calm: a 120 ms fade or a still ---------- */
@media (prefers-reduced-motion: reduce) {
  .v21c-pin.is-revealing, .v21c-track .mk.just-done, .v21c-bar.is-hit { animation: v21c-fade 120ms linear both !important; }
  .v21c-bar .fill, .v21c-qhead .v21c-chev, .v21c-pinbtn { transition: none !important; }
}
:root[data-motion="reduced"] .v21c-pin.is-revealing, :root[data-motion="reduced"] .v21c-track .mk.just-done, :root[data-motion="reduced"] .v21c-bar.is-hit,
:root[data-calm="on"] .v21c-pin.is-revealing, :root[data-calm="on"] .v21c-track .mk.just-done, :root[data-calm="on"] .v21c-bar.is-hit { animation: v21c-fade 120ms linear both !important; }
:root[data-motion="reduced"] .v21c-bar .fill, :root[data-calm="on"] .v21c-bar .fill,
:root[data-motion="reduced"] .v21c-qhead .v21c-chev, :root[data-calm="on"] .v21c-qhead .v21c-chev { transition: none !important; }

/* ---------- Days that matter: nothing animates but fades; the boss is never shown ---------- */
:root[data-day-matters]:not([data-day-matters=""]) .v21c-boss { display: none !important; }
:root[data-day-matters]:not([data-day-matters=""]) .v21c-pin.is-revealing,
:root[data-day-matters]:not([data-day-matters=""]) .v21c-track .mk.just-done { animation: v21c-fade 120ms linear both !important; }
