/* hub.css: the kit's start page only (index.html). Tokens and components come from quadcode-ui.css. */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 96px; }
main > .qc-top { padding: 40px 0 4px; }
main > .qc-top h1 { font-size: 40px; margin: 0; }
.hub-meta { margin: 8px 0 0; color: var(--qc-muted); font: 400 14px/1.4 var(--qc-mono); }
section { padding-top: 28px; animation: fade .5s ease both; }
section > h2 { font: 600 22px/1.2 var(--qc-ui); margin: 0 0 12px; scroll-margin-top: 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { section { animation: none; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 10px; }
.qc-card[aria-disabled='true'] { opacity: .4; pointer-events: none; }
.qc-card.on { border-color: rgba(255, 255, 255, .32); }

#pick { margin-bottom: 14px; }
#pick .qc-tab small { margin-left: 8px; font: 400 12px/1 var(--qc-mono); color: var(--qc-faint); }

.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 920px) { .viewer { grid-template-columns: 1fr; } }

.stage { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--qc-panel); border: 1px solid var(--qc-line); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: var(--qc-page); }
.stage-hint { position: absolute; right: 12px; top: 10px;   /* top right: on a title the key caps sit along the bottom and the name on the left (R23) */ margin: 0; padding: 6px 10px; border-radius: 8px; background: rgba(11, 13, 21, .78); color: var(--qc-soft); font-size: 13px; pointer-events: none; animation: hint-out .3s ease 5s forwards; }
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }

.info { background: var(--qc-panel); border: 1px solid var(--qc-line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.info-head h3 { margin: 4px 0 6px; font: 600 26px/1.1 var(--qc-ui); }
.info-head code { color: var(--qc-muted); font-size: 13px; }
.count { color: var(--qc-faint); font: 500 12px/1 var(--qc-mono); letter-spacing: .04em; }
.pick-for { margin: 0; color: var(--qc-soft); font-size: 15px; line-height: 1.5; }
#modes { margin: 0 -12px; }
.readout { min-height: 22px; font: 400 13px/1.5 var(--qc-mono); color: var(--qc-soft); }
.readout .ok { color: var(--qc-ok); }
.readout .bad { color: var(--qc-bad); }
.readout .warn { color: var(--qc-warn); }
.readout ul { margin: 6px 0 0; padding-left: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.keys { margin: 0; color: var(--qc-faint); font-size: 13px; }

.doc { margin-top: 18px; background: var(--qc-panel); border: 1px solid var(--qc-line); border-radius: 12px; padding: 22px 26px; color: var(--qc-soft); line-height: 1.6; overflow-wrap: break-word; }
.doc:empty { display: none; }
.doc h1, .doc h2, .doc h3, .doc h4 { color: var(--qc-text); font-family: var(--qc-ui); line-height: 1.2; margin: 1.4em 0 .5em; }
.doc h1 { font-size: 26px; margin-top: 0; }
.doc h2 { font-size: 20px; }
.doc h3 { font-size: 17px; }
.doc p, .doc ul, .doc ol, .doc table, .doc pre { margin: 0 0 12px; }
.doc a { color: var(--qc-accent); }
.doc code { font-size: .88em; background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 4px; }
.doc pre { background: var(--qc-page); border: 1px solid var(--qc-line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.doc pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
.doc table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--qc-line); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { color: var(--qc-text); background: rgba(255, 255, 255, .03); }
.doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -6px 0 14px; color: var(--qc-faint); font: 400 12px/1 var(--qc-mono); }
.doc-bar button { background: none; border: 0; color: var(--qc-muted); cursor: pointer; font: 500 13px/1 var(--qc-ui); padding: 6px 0; }
.doc-bar button:hover { color: var(--qc-text); }

/* ---- Models: viewer + grid */
.h-count { color: var(--qc-faint); font: 400 14px/1 var(--qc-mono); margin-left: 8px; }
.mv { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: stretch; }
@media (max-width: 920px) { .mv { grid-template-columns: 1fr; } }
.mv-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: #12151f; border: 1px solid var(--qc-line); outline: none; cursor: grab; touch-action: none; }
.mv-stage:active { cursor: grabbing; }
.mv-stage:focus-visible { border-color: rgba(255, 255, 255, .4); }
.mv-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mv-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; color: var(--qc-muted); font: 500 14px/1 var(--qc-ui); }
.mv-tools { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.mv-tools .qc-btn { min-height: 32px; padding: 0 12px; font-size: 13px; background: rgba(11, 13, 21, .72); }
.mv-tools .qc-btn[aria-pressed='true'] { color: var(--qc-text); border-color: rgba(255, 255, 255, .34); }
.mv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: 8px; background: rgba(11, 13, 21, .55); color: var(--qc-soft); font: 400 30px/1 var(--qc-ui); cursor: pointer; opacity: 0; transition: opacity .2s; }
.mv-stage:hover .mv-nav, .mv-nav:focus-visible { opacity: 1; }
.mv-nav:hover { color: var(--qc-text); background: rgba(11, 13, 21, .8); }
.mv-nav.prev { left: 10px; } .mv-nav.next { right: 10px; }
@media (hover: none) { .mv-nav { opacity: 1; } }
.mv-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font: 400 13px/1.3 var(--qc-mono); }
.mv-stats dt { color: var(--qc-faint); }
.mv-stats dd { margin: 0; color: var(--qc-text); text-align: right; }
.mv-label { margin: 0 0 8px; color: var(--qc-faint); font: 500 12px/1 var(--qc-mono); letter-spacing: .04em; text-transform: uppercase; }
.mv-clips { display: flex; flex-wrap: wrap; gap: 6px; }
.mv-clips button { border: 1px solid var(--qc-line); background: transparent; color: var(--qc-soft); border-radius: 6px; padding: 6px 10px;   /* 3.4.2: a wall of 40+ clips read as ovals, now the inputs' 6 px */ font: 500 13px/1 var(--qc-ui); cursor: pointer; }
.mv-clips button:hover { color: var(--qc-text); border-color: rgba(255, 255, 255, .3); }
.mv-clips button[aria-pressed='true'] { background: var(--qc-text); color: var(--qc-page); border-color: var(--qc-text); }
.mv-clips .none { color: var(--qc-faint); font-size: 13px; }

.mfilter { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 18px 0 12px; }
#mGroups { margin: 0 -12px; flex-wrap: wrap; }   /* R21A: twenty groups wrap onto two rows, none hidden behind the edge */
#mGroups .qc-tab small { margin-left: 6px; font: 400 12px/1 var(--qc-mono); color: var(--qc-faint); }
.mf-search { min-width: 220px; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--qc-line); background: var(--qc-panel); color: var(--qc-text); font: 400 14px/1 var(--qc-ui); }
.mf-search:focus { outline: none; border-color: rgba(255, 255, 255, .34); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--qc-line); border-radius: 10px; background: var(--qc-panel); overflow: hidden; cursor: pointer; padding: 0; text-align: left; color: inherit; font: inherit; transition: border-color .15s, transform .15s; }
.mcard[hidden] { display: none; }
.mcard:hover { border-color: rgba(255, 255, 255, .26); transform: translateY(-2px); }
.mcard[aria-current='true'] { border-color: var(--qc-text); }
.mcard .thumb { aspect-ratio: 1; width: 100%; height: auto; background: #12151f; display: block; object-fit: cover; }
.mcard .thumb.wait { background: linear-gradient(100deg, #12151f 40%, #181c28 50%, #12151f 60%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .mcard .thumb.wait { animation: none; } .mcard:hover { transform: none; } }
.mcard .mc-body { padding: 8px 10px 10px; display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.mcard .mc-name { font: 500 14px/1.2 var(--qc-ui); color: var(--qc-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .mc-tag { font: 400 11px/1 var(--qc-mono); color: var(--qc-faint); white-space: nowrap; }
.mcard .mc-anim { position: absolute; top: 8px; right: 8px; padding: 3px 7px; border-radius: 999px; background: rgba(11, 13, 21, .7); color: var(--qc-soft); font: 500 11px/1 var(--qc-mono); }
.mgrid .empty { grid-column: 1 / -1; color: var(--qc-muted); padding: 20px 0; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.st-card { border-radius: 12px; overflow: hidden; background: var(--qc-panel, rgba(255, 255, 255, .04)); padding-bottom: 10px; }
.st-sky { height: 56px; }
.st-row { display: flex; height: 18px; }
.st-row i { flex: 1; }
.st-card code { display: block; margin: 10px 12px 2px; font: 400 13px/1.3 var(--qc-mono); }
.st-card p { margin: 0 12px; color: var(--qc-muted); font-size: 13px; line-height: 1.35; }

/* R18 punch list. Ids match .temp/look_review/hub_punch_list.md */
:root { --qc-faint: rgba(255, 255, 255, .52); }                                     /* H4 */

.qc-sitebar .qc-tabs { max-width: 1180px; margin: 0 auto; padding: 0 2px; }         /* L1 */

main > .qc-top { padding-top: 28px; }                                               /* H5 */

.mv-stats { grid-template-columns: auto 1fr auto 1fr; gap: 6px 10px; }              /* H5, with models.js */
.h-count { letter-spacing: 0; text-transform: none; }                               /* M2 */
.doc h2 { text-transform: none; letter-spacing: 0; }                                /* M1 */

#pick { margin-bottom: 0; }                                                         /* M3 */
.qc-tabbar { margin-bottom: 14px; }
#pick .qc-tab { flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 52px; padding: 9px 14px 12px; }   /* H3 */
#pick .qc-tab small { margin-left: 0; }
#pick .tab-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }


.viewer { align-items: stretch; }                                                   /* M5 */
.viewer .stage { align-self: start; width: 100%; }
.info .keys { margin-top: auto; }

/* M8, 3.4.2: buttons sized by their words; flex-grow stretched the pair into two ovals 755 and 802 px wide across the panel */
.actions .qc-btn { flex: 0 0 auto; min-height: 40px; padding: 0 22px; }
@media (max-width: 520px) { .actions .qc-btn { flex: 1 1 100%; } }                  /* a phone: one full-width button a row */
.info-head code { overflow-wrap: anywhere; }                                        /* L6 */
#modes .qc-tab:disabled { display: none; }                                          /* L8 */

.mcard .mc-body { flex-direction: column; align-items: flex-start; gap: 3px; }      /* M4 */
.mcard .mc-name { max-width: 100%; }
/* 2.6.0: a long model name ("Shop Building Skyscraper", most of the 162 buildings) wraps to a second line instead of losing its end */
.mcard .mc-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mf-search { flex: 1 1 220px; max-width: 360px; }                                   /* L4 */

.st-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }          /* L2, L3 */
.st-card { border: 1px solid var(--qc-line); }                                      /* L7 */
.grid { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }   /* L2 */
@media (min-width: 720px) { #docCards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }   /* L2, L5 */

@media (max-width: 920px) {                                                         /* H6, M6, L9 */
  main > .qc-top { padding-top: 20px; }
  .hub-meta { margin-top: 0; }
  .mv-stage { aspect-ratio: auto; height: min(50vh, 62.5vw); }
  .mv-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 28px; align-content: start; }
  .mv-info > .info-head { grid-area: 1 / 1; }
  .mv-info > .pick-for { grid-area: 2 / 1; }
  .mv-info > .actions { grid-area: 3 / 1; }
  .mv-info > .mv-stats { grid-area: 1 / 2; }
  .mv-info > div:has(> .mv-clips) { grid-area: 2 / 2 / 4 / 3; }
  .mv-info > .keys { grid-area: 5 / 1 / 6 / 3; margin-top: 0; }
  .mv-info > .mv-own { grid-area: 4 / 1 / 5 / 3; }
  .mv-info { align-items: start; }                                                   /* 70 clip chips no longer stretch the buttons beside them */
  .mv-info .mv-clips { max-height: 210px; overflow-y: auto; scrollbar-width: thin; }
}
@media (max-width: 700px) { .mv-info { display: flex; } }

/* 2.0.0 polish: the viewer keeps its own shape. The info column used to set the row height, so 64 clip chips stretched the
   stage to a tall portrait and the model filled it head first. The stage keeps 16:10; the info column is as tall as the stage
   and scrolls inside itself (the clip list scrolls, the head and the stats stay) */
.mv { align-items: start; }
.mv-stage { align-self: start; }
@media (min-width: 921px) {
  .mv-info { max-height: calc((min(1180px, 100vw) - 32px - 336px) * 0.625); overflow-y: auto; scrollbar-width: thin; }
  .viewer { align-items: start; }
  .viewer .info { max-height: calc((min(1180px, 100vw) - 32px - 336px) * 0.5625); overflow-y: auto; }
}
.mv-stats dd { white-space: nowrap; }
.viewer .info { scrollbar-width: thin; }

/* R16A: the template tabs by genre family: a small label over each group, a hairline between groups; the bar still scrolls as one row */
#pick { align-items: flex-end; }
#pick .fam { display: flex; flex-direction: column; flex: 1 0 auto; min-width: 0; }
#pick .fam + .fam { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--qc-line); }
#pick .fam-name { padding: 0 14px; font: 500 11px/1.2 var(--qc-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--qc-faint); white-space: nowrap; }
#pick .fam-tabs { display: flex; gap: 2px; }
/* R16A: the systems cards: a name, one line of what it gives, the file it lives in */
#sysCards { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.sys-card[hidden] { display: none; }
.sys-card .sys-text { display: block; margin: 6px 0 8px; color: var(--qc-muted); font: 400 13px/1.45 var(--qc-ui); }
.sys-card code { overflow-wrap: anywhere; }
/* Yours: models the user adds (models.js, hub/yours.html) */
.mf-right { display: flex; gap: 8px; align-items: center; flex: 1 1 320px; justify-content: flex-end; }
.mf-right .qc-btn { min-height: 36px; padding: 0 14px; white-space: nowrap; }
.m-note { margin: -4px 0 12px; color: var(--qc-muted); font: 400 14px/1.4 var(--qc-ui); }
.m-note.bad { color: #f2b35a; }
.mv-tools [hidden], .mv-own[hidden] { display: none; }
.mv-kit { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #12151f; }
.mv-kit[hidden] { display: none; }
.mv-stage.kit { cursor: default; }
.mv-stage.kit .mv-nav, .mv-stage.kit #mvSpin, .mv-stage.kit #mvWire, .mv-stage.kit #mvReset { display: none; }
.mv-drop { position: absolute; inset: 10px; margin: 0; display: none; place-items: center; border: 1px dashed rgba(255, 255, 255, .4); border-radius: 10px; background: rgba(11, 13, 21, .72); color: var(--qc-text); font: 500 16px/1 var(--qc-ui); pointer-events: none; }
#models.drop .mv-drop { display: grid; }
.mv-own { display: flex; flex-direction: column; gap: 10px; }
.mv-own-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mv-own-row label { display: inline-flex; gap: 6px; align-items: center; color: var(--qc-faint); font: 500 12px/1 var(--qc-mono); letter-spacing: .04em; text-transform: uppercase; }
.mv-own-row input, .mv-own-row select { height: 30px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--qc-line); background: var(--qc-panel); color: var(--qc-text); font: 400 13px/1 var(--qc-mono); text-transform: none; }
.mv-own-row input { width: 62px; }
.mv-own-row .qc-btn { min-height: 30px; padding: 0 12px; font-size: 13px; margin-left: auto; }
.mv-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font: 400 13px/1.4 var(--qc-ui); color: var(--qc-soft); }
.mv-checks li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.mv-checks li span { font: 500 11px/1.6 var(--qc-mono); color: var(--qc-faint); }
.mv-checks li.warn span { color: #f2b35a; }

/* the template README folds under the games, so the models follow the games at once */
.tpl-doc { margin-top: 20px; }
.tpl-doc > summary { cursor: pointer; width: max-content; font: 500 15px/1 var(--qc-ui); color: var(--qc-text); padding: 10px 0; }
.tpl-doc > summary:hover { color: #fff; }
.tpl-doc[open] > summary { margin-bottom: 12px; }
