/* The library window (site/assets.html + js/library.js). Only tokens from tokens.css; the shared .lib grid, .acard,
   .adetail, .chips and .dialog come from app.css - this file adds the tabs, plan badges, looping previews, locks,
   the "in my game" list, the upload dialog and the phone bottom sheet. */

.lib-head { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-top: 28px; }
.lib-head h1, .lib-head h2 { font-size: var(--fs-2xl); }
.lib-head p { color: var(--muted); margin-top: 4px; max-width: 640px; }
.lib-head .acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* the plan the prototype is looking as (Pro / Max / Ultra) */
.plan-view { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.plan-view > span { font-size: var(--fs-xs); color: var(--dim); font-weight: 700; padding: 0 6px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.plan-view button { border: 0; background: none; color: var(--muted); font-weight: 700; font-size: var(--fs-sm); padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; }
.plan-view button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.lib-tabs { margin-top: 18px; }
.lib-tabs button { display: inline-flex; gap: 7px; align-items: center; }
.lib-tabs button .ic { width: 16px; height: 16px; }
.lib-tabs button small { font-weight: 600; color: var(--dim); font-size: 12px; }

.lib-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.lib-filters[hidden] { display: none; }
.lib-filters select { padding: 9px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; }
.toggle { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: var(--fs-sm); font-weight: 700; cursor: pointer; }
.toggle[aria-pressed="true"] { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.toggle .ic { width: 15px; height: 15px; }
.lib-count { margin-left: auto; color: var(--dim); font-size: var(--fs-sm); }

/* cards: a still, and on hover its loop (a strip of N frames slid in N steps) */
.agrid.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.acard { position: relative; }
.thumb { position: relative; overflow: hidden; border-radius: 11px; aspect-ratio: 1; background: var(--bg-2); }
.agrid.wide .thumb { aspect-ratio: 16 / 10; }
.thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .strip { position: absolute; inset: 0 auto 0 0; height: 100%; width: calc(var(--n) * 100%); max-width: none; opacity: 0; }
.acard:hover .thumb .strip, .acard:focus-visible .thumb .strip, .turn.playing .thumb .strip { opacity: 1; animation: strip var(--dur) steps(var(--n)) infinite; }
@keyframes strip { to { transform: translateX(-100%); } }
.thumb .glyph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); }
.thumb .glyph .ic { width: 44px; height: 44px; }
.thumb .count { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(10, 11, 16, 0.7); color: #e9eaee; font-size: 12px; font-weight: 800; }

.plan { position: absolute; top: 14px; left: 14px; z-index: 2; display: inline-flex; gap: 4px; align-items: center; padding: 3px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.plan .ic { width: 12px; height: 12px; }
.plan-pro { background: rgba(10, 11, 16, 0.72); color: #dfe3ea; }
.plan-max { background: var(--gold); color: var(--gold-ink); }
.plan-ultra { background: linear-gradient(120deg, var(--coral), #b06bff); color: #fff; }
.phone-dot { position: absolute; top: 14px; right: 14px; z-index: 2; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(10, 11, 16, 0.72); color: var(--live); }
.phone-dot .ic { width: 13px; height: 13px; }

.acard.locked .thumb > img, .acard.locked .thumb .strip { filter: grayscale(.65) brightness(.55); }
.acard.locked .lockmark { position: absolute; inset: 8px 8px auto 8px; aspect-ratio: 1; display: grid; place-items: center; pointer-events: none; }
.agrid.wide .acard.locked .lockmark { aspect-ratio: 16 / 10; }
.lockmark span { display: inline-flex; gap: 6px; align-items: center; padding: 6px 11px; border-radius: var(--r-pill); background: rgba(10, 11, 16, 0.78); color: #f2f3f5; font-size: 12px; font-weight: 800; }
.lockmark .ic { width: 14px; height: 14px; }
.acard small .size { color: var(--dim); }

.more { display: flex; justify-content: center; margin-top: 18px; }

/* the detail panel */
.adetail .turn { aspect-ratio: 1; }
.adetail.wide .turn { aspect-ratio: 16 / 10; }
.adetail .turn > img { width: 100%; height: 100%; object-fit: cover; }
.adetail .turn .thumb { aspect-ratio: auto; height: 100%; border-radius: 0; }
.adetail .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.adetail .badges .plan { position: static; }
.adetail .note { color: var(--muted); font-size: var(--fs-sm); margin-top: 10px; }
.adetail .tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0 14px; }
.adetail .tags span { padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.adetail .acts { display: grid; gap: 8px; }
.adetail .lic { font-size: 12px; color: var(--dim); margin-top: 12px; line-height: 1.45; word-break: break-word; }
.adetail audio { width: 100%; margin: 4px 0 12px; }
.adetail .close-sheet { display: none; }
.upsell { padding: 14px; border-radius: 14px; background: linear-gradient(150deg, var(--gold-soft), transparent 75%), var(--bg-2); border: 1px solid var(--line); }
.upsell h3 { font-size: var(--fs-md); display: flex; gap: 8px; align-items: center; }
.upsell h3 .ic { color: var(--gold-text); width: 18px; height: 18px; }
.upsell p { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }

/* "In my game": the mock project's list */
.mine-list { display: grid; gap: 6px; margin-top: 6px; }
.mine-list div { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface); font-size: 13px; }
.mine-list img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; background: var(--bg-2); }
.mine-list b { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-list button { border: 0; background: none; color: var(--dim); cursor: pointer; padding: 2px; }
.mine-list button .ic { width: 14px; height: 14px; }
.mine-empty { color: var(--dim); font-size: 13px; padding: 4px 12px; }

/* uploads */
.up-locked { padding: 28px; border-radius: 20px; border: 1px dashed var(--line-2); text-align: center; display: grid; gap: 10px; justify-items: center; }
.up-locked .ic { width: 34px; height: 34px; color: var(--gold-text); }
.up-locked p { color: var(--muted); max-width: 520px; }
.drop { border: 2px dashed var(--line-2); border-radius: 16px; padding: 22px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--teal); color: var(--text); background: var(--teal-soft); }
.drop .ic { width: 30px; height: 30px; }
.drop input { display: none; }
.bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--sky)); transition: width .25s; }
.checks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks li .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.checks .ok .ic { color: var(--teal); }
.checks .warn .ic { color: var(--gold-text); }
.checks .bad .ic { color: var(--danger); }
.checks .wait { color: var(--dim); }
.checks small { color: var(--dim); display: block; }
.rights { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; }
.rights input { margin-top: 3px; }

@media (max-width: 860px) {
  .lib-count { margin-left: 0; width: 100%; }
  .agrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .agrid.wide { grid-template-columns: 1fr; }
  /* the detail opens as a bottom sheet */
  .adetail { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow: auto; border-radius: 20px 20px 0 0; transform: translateY(105%); transition: transform .22s; box-shadow: var(--shadow); }
  .adetail.open { transform: none; }
  .adetail .close-sheet { display: inline-flex; position: absolute; top: 10px; right: 10px; z-index: 3; }
  .adetail .turn { max-height: 42vh; margin: 0 auto; }
  .plan-view { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .acard:hover .thumb .strip, .turn.playing .thumb .strip { animation: none; opacity: 0; }
}

/* app.css sizes every picture in the detail's turntable to cover it; the loop strip keeps its own width */
.adetail .turn .thumb img.strip { width: calc(var(--n) * 100%); height: 100%; object-fit: fill; }
.adetail .turn .thumb > img:not(.strip) { position: absolute; inset: 0; }

/* inside the studio's library drawer (assets.html?embed=1): no site chrome, the shelves only */
body.embed .top, body.embed .foot, body.embed .lib-head p { display: none; }
body.embed .lib-head { margin-top: 12px; }
body.embed main.wrap { width: calc(100% - 24px); }
body.embed .lib { grid-template-columns: minmax(0, 1fr) 300px; }
body.embed .lib-side { display: none; }
@media (max-width: 860px) { body.embed .lib { grid-template-columns: 1fr; } }
.pick-list { display: grid; gap: 8px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.pick-row:hover, .pick-row:focus-visible { border-color: var(--teal); }
.pick-row span { flex: 1; display: grid; }
.pick-row small { color: var(--muted); font-size: 12px; }

/* ---- every card's own actions (Alvin, 2026-10-09: "every model should have a button use on the game"): the picture and
   name open the details; under them "Use in game" (or "Unlock with Max/Ultra") and Details, always visible - no hover */
.agrid:not(.wide) { grid-template-columns: repeat(auto-fill, minmax(182px, 1fr)); }   /* room for a card's own buttons */
.acard { display: flex; flex-direction: column; cursor: default; }
.acard.picked { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.acard-open { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 11px; }
.acard-open:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.acard-acts { display: flex; gap: 6px; align-items: center; margin: 8px 2px 2px; }
.acard-acts .btn { flex: 1; min-width: 0; justify-content: center; gap: 5px; padding: 7px 8px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard-acts .btn .ic { width: 15px; height: 15px; flex: none; }
.acard-acts .icon-btn { flex: none; width: 32px; height: 32px; }
.adetail .thumb .len { display: none; }
.acard-acts .icon-btn .ic { width: 17px; height: 17px; }
.acard-unlock { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); font-size: 12.5px !important; }
.acard-unlock .ic { color: var(--gold); }
.acard.locked .lockmark { inset: 8px 8px auto 8px; }

/* sounds: a wave drawn from the id, the length, and a play button over it */
.thumb.snd { background: linear-gradient(160deg, var(--teal-soft), transparent 70%), var(--bg-2); }
.thumb .wave { position: absolute; inset: 22% 12% 26%; display: flex; align-items: center; gap: 3%; }
.thumb .wave i { flex: 1; height: var(--h); min-height: 6%; border-radius: 3px; background: var(--teal); opacity: .75; }
.thumb .wave.music i { background: var(--gold); }
.thumb .len { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(10, 11, 16, 0.7); color: #e9eaee; font-size: 11px; font-weight: 800; }
/* centred on the square picture: the card is a size container, so 50cqw is half the picture (the card's content width) */
.acard { position: relative; container-type: inline-size; }
.acard-play { position: absolute; left: 50%; top: calc(8px + 50cqw); transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(10, 11, 16, 0.78); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
.acard-play .ic { width: 20px; height: 20px; margin-left: 3px; }
.acard-play .pause { display: none; width: 14px; height: 16px; border-left: 5px solid #fff; border-right: 5px solid #fff; box-sizing: border-box; }
.acard-play.playing { background: var(--teal); color: #0b0c10; }
.acard-play.playing .ic { display: none; }
.acard-play.playing .pause { display: block; border-color: #0b0c10; }
.acard-play:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* the jobs' filter (GFX, Animations, SFX): a row of chips that scrolls on a phone */
.job-chips { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding-bottom: 4px; margin: -4px 0 14px; scrollbar-width: thin; }
.job-chips[hidden] { display: none; }
.job-chips .lbl { font-size: var(--fs-xs); color: var(--dim); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding-right: 2px; flex: none; }
.job-chips .chip { flex: none; padding: 6px 11px; font-size: 13px; }
.job-chips .chip small { color: inherit; opacity: .7; font-weight: 600; }

/* phones: two columns; the tabs scroll sideways */
.lib-tabs { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.lib-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 560px) {
  .agrid:not(.wide) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .acard-acts .btn { padding: 7px 6px; font-size: 12.5px; }
  .acard-unlock { font-size: 12px !important; }
  .acard-acts .icon-btn { width: 32px; height: 32px; }
}

/* ---- the studio's Library tab (assets.html?embed=1 inside the preview panel): the grid takes the width, the details
   slide in over it from the right */
body.embed { background: var(--bg); }
body.embed .lib-head { display: none; }
body.embed .lib-tabs { margin-top: 2px; position: sticky; top: 0; z-index: 5; background: var(--bg); }
body.embed main.wrap { width: calc(100% - 20px); padding-bottom: 20px; margin-top: 0; }   /* (no room kept for the hidden header's verify bar) */
body.embed .lib { grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
body.embed .lib-top { margin-bottom: 10px; }
body.embed .lib-top .search { height: 40px; }
body.embed .lib-filters { margin-bottom: 10px; }
body.embed .agrid:not(.wide) { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); }
body.embed .adetail { position: fixed; z-index: 90; top: 8px; right: 8px; bottom: 8px; left: auto; width: min(380px, calc(100% - 16px)); max-height: none; overflow: auto; border-radius: 18px;
  transform: translateX(calc(100% + 24px)); transition: transform .22s; box-shadow: var(--shadow); display: block; }
body.embed .adetail.open { transform: none; }
body.embed .adetail .close-sheet { display: inline-flex; position: absolute; top: 10px; right: 10px; z-index: 3; }
body.embed .adetail .turn { max-height: 40vh; }
@media (max-width: 560px) { body.embed .agrid:not(.wide) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { body.embed .adetail { transition: none; } }
