/* The Works' window, yard first: nearly the whole screen, a stage on the left (the yard as big as it fits, with the funds
   plate, the yard's controls and the stamp press standing over its front corner) and a ledger on the right whose tabs are
   the crews, the post, the Boardroom and Hard Times, with the charter at its foot. The Boardroom and Hard Times widen the
   ledger; the yard stays in view whatever it shows. On a phone it's one column: funds, the yard, the ledger, the dock. */
#works .shopcard { text-align: left; }
.wkmain { margin-top: 10px; }
.wkledger { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wkledger .wktabs { width: 100%; margin: 0; }
.wkledger .wktabs button { flex: 1 1 auto; min-width: 0; padding-left: 6px; padding-right: 6px; font-size: 11.5px; letter-spacing: 0.5px; }
.wkbody { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wkbody .hnote { margin: 4px 2px 0; }
.wkledger .wkposttab { max-width: none; margin-top: 0; }
.wkyardtop { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.wkyardtop .wkyardhd { gap: 10px; }
.wkyardtop .wkmovebtn { margin-right: 0; }

@media (min-width: 720px) {
  #works.gamewin { padding: 14px; }
  #works .shopcard { max-width: none; width: calc(100vw - 28px); height: calc(100dvh - 28px); display: flex; flex-direction: column; padding: 16px 20px 20px; }
  #works .shopcard > h2 { margin: 0 56px 0 0; }
  .wkmain { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 16px; }
  .wkmain[data-tab="board"], .wkmain[data-tab="trials"] { grid-template-columns: minmax(0, 1fr) min(860px, 58%); }

  /* the stage: the yard as big as it fits, everything else over it */
  .wkstage { position: relative; min-width: 0; min-height: 0; overflow: hidden; container-type: size; border: 3px solid var(--wk-ink, #0a0612); border-radius: 14px;
    background: #05070e; box-shadow: 0 6px 0 var(--wk-ink, #0a0612); }
  /* (filling the stage edge to edge where that crops little: never more than 12% past fitting it whole) */
  .wkstage { --yfit: min(100cqw, calc(100cqh * var(--ya, 1.333))); }
  .wkstage .wkyard { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(max(100cqw, calc(100cqh * var(--ya, 1.333))), calc(1.12 * var(--yfit))); border: 0; border-radius: 0; min-height: 0; }
  .wkstage::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 70px 24px #05070e; }
  .wkstage .wkfundsbox { position: absolute; left: 14px; top: 14px; z-index: 6; max-width: min(360px, 42cqw); }
  .wkstage .wkyardtop { position: absolute; right: 14px; top: 14px; z-index: 6; max-width: 50cqw; }
  .wkstage .wkyardtop .wktape { padding: 6px 12px; border: 3px solid var(--wk-ink, #0a0612); border-radius: 10px; background: linear-gradient(170deg, #3a4048, #2a2e36); box-shadow: 0 4px 0 var(--wk-ink, #0a0612); }
  .wkstage .wkyardhint { padding: 4px 10px; border-radius: 8px; background: rgba(5, 7, 14, 0.75); }
  .wkstage .ywait { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 6; margin: 0; padding: 8px 10px; max-width: 70cqw; border: 3px solid var(--wk-ink, #0a0612); border-radius: 12px; background: linear-gradient(170deg, #3a4048, #2a2e36); }
  /* the press stands in the stage's front corner, its rhythm and keys on a plate under it */
  .wkstage .wkpressbox { position: absolute; left: 0; bottom: 0; z-index: 5; width: clamp(240px, 34cqw, 600px); padding: 0 0 12px 12px; border: 0; border-radius: 0; box-shadow: none; background: none; overflow: visible; }
  .wkstage .wkmeta { display: inline-flex; gap: 10px; margin: 0; padding: 7px 12px; border: 3px solid var(--wk-ink, #0a0612); border-radius: 10px; background: linear-gradient(170deg, #3a4048, #2a2e36); box-shadow: 0 4px 0 var(--wk-ink, #0a0612); }

  /* the ledger: its tab's page scrolls, the charter stays at its foot */
  .wkledger { min-height: 0; }
  .wkledger > .wkbody, .wkledger > .wkposttab, .wkledger > .wkboard, .wkledger > .wktrials { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
  .wkledger .wkcrews { max-height: none; overflow: visible; }
  .wkledger .wbgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wkledger > .wkcharter { flex: none; }
}

@media (min-width: 720px) and (max-width: 1099px) {
  .wkmain { grid-template-columns: minmax(0, 1fr) 340px; }
  .wkmain[data-tab="board"], .wkmain[data-tab="trials"] { grid-template-columns: minmax(0, 1fr) 52%; }
  .wkledger .wbgrid { grid-template-columns: minmax(0, 1fr); }
  .wkledger .wktabs button { font-size: 10.5px; letter-spacing: 0; white-space: normal; line-height: 1.1; } .wkledger .wktabs button .gi-e { display: none; }
}

@media (max-width: 719px) {
  #works .shopcard { width: calc(100vw - 16px); padding: 14px 10px 0; }
  .wkmain { display: flex; flex-direction: column; gap: 12px; }
  .wkstage { display: flex; flex-direction: column; gap: 10px; }
  .wkstage .wkfundsbox { order: 1; } .wkstage .wkyardtop { order: 2; align-items: stretch; } .wkstage .wkyard { order: 3; } .wkstage .ywait { order: 4; }
  .wkyardtop .wkyardhd { justify-content: space-between; }
  .wkstage .wkpressbox { display: none; }
}
